<script setup lang="ts">
// App.vue - 主应用组件
</script>

<template>
  <div id="app">
    <nav class="navbar" v-if="$route.path !== '/login' && $route.path !== '/register'">
      <div class="nav-container">
        <router-link to="/" class="nav-brand">
          <img src="/vite.svg" class="logo" alt="Logo" />
          <span>Vue SRI App</span>
        </router-link>
        
        <div class="nav-links">
          <router-link to="/" class="nav-link">首页</router-link>
          <router-link to="/login" class="nav-link">登录</router-link>
          <router-link to="/register" class="nav-link">注册</router-link>
        </div>
      </div>
    </nav>
    
    <main class="main-content">
      <router-view />
    </main>
  </div>
</template>

<style>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: #f8f9fa;
}

#app {
  min-height: 100vh;
}

.navbar {
  background: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 70px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: #2c3e50;
  font-weight: 700;
  font-size: 1.2rem;
}

.logo {
  height: 2rem;
  width: 2rem;
}

.nav-links {
  display: flex;
  gap: 2rem;
}

.nav-link {
  text-decoration: none;
  color: #7f8c8d;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: all 0.3s ease;
}

.nav-link:hover {
  color: #3498db;
  background-color: #f8f9fa;
}

.nav-link.router-link-active {
  color: #3498db;
  background-color: #e3f2fd;
}

.main-content {
  min-height: calc(100vh - 70px);
}

/* 当在登录/注册页面时，移除导航栏的高度计算 */
.main-content:has(.login),
.main-content:has(.register) {
  min-height: 100vh;
}
</style>
